<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class UserCouponResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
    public function toArray($request)
    {
        $this->resource->makeHidden(['created_at', 'updated_at']);
        $data = parent::toArray($request);
        $data['status'] = $this->status;
        $data['status_ch'] = $this->status_ch;
        $data['user'] = new UserResource($this->whenLoaded('user'));
        $data['dealer'] = new DealerResource($this->whenLoaded('dealer'));
        return $data;
    }
}
